package com.iyimo.manager{
	import com.iyimo.core.YEngine;
	
	import flash.display.Sprite;

	public class PopUpManager{
		public function PopUpManager(){}
		
		public static function addPopUp(window:Sprite, modal:Boolean = false):void{
			var layer:Sprite = YEngine.instance.layerManager.popLayer;
			window.x = (YEngine.instance.width - window.width) * .5;
			window.y = (YEngine.instance.height - window.height) * .5;
			layer.addChild(window);
			
			if (modal){
				layer.graphics.beginFill(0x000000, .6);
				layer.graphics.drawRect(0, 0, YEngine.instance.width, YEngine.instance.height);
				layer.graphics.endFill();
			}
		}
		
		public static function removePopUp(window:Sprite):void{
			YEngine.instance.layerManager.popLayer.removeChild(window);
			YEngine.instance.layerManager.popLayer.graphics.clear();
		}
	}
}